package battle;

import java.io.IOException;
import java.util.Random;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class BattleServlet extends HttpServlet {
	public class ShainEditServlet extends HttpServlet {
		protected void doGet(HttpServletRequest req, HttpServletResponse resp)
				throws ServletException, IOException {
			perform(req,resp);
		}

		@Override
		protected void doPost(HttpServletRequest req, HttpServletResponse resp)
				throws ServletException, IOException {
			perform(req,resp);
		}
		
		private void perform(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{
			resp.setContentType("text/html;charset=UTF-8");
			req.setCharacterEncoding("UTF-8");
			
			String strselect = req.getParameter("select");//こちらの選択
			int select = Integer.parseInt(strselect); 
			
			Random rnd = new Random();
			int random = rnd.nextInt(4);//相手の選択
			
			Attack attack = new Attack();
			
			attack.attack(select);
			
		}
	}
}
